package com.maocc.springnancore;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;

@Slf4j
@SpringBootApplication
public class SpringNanCoreApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext ctx = SpringApplication.run(SpringNanCoreApplication.class, args);
        Arrays.stream(ctx.getEnvironment().getActiveProfiles()).forEach(log::info);
        InetAddress addr = InetAddress.getLocalHost();
        String ip = addr.getHostAddress();
        String port = ctx.getEnvironment().getProperty("server.port");
        log.info(String.format("项目路径：http://%s:%s/", ip, port));
    }

}
